import { ACCESS_NUM } from '@/access/accessNum'

 const routes = [
  // 主页
  {
    name: 'Home',
    path: '/',
    component: () => import('@/views/HomePage.vue'),
    meta: { hideInMenu: false }
  },

  // 创建/修改应用
  {
    name: '创建应用',
    path: '/add/app',
    component: () => import('@/views/add/AddAppPage.vue'),
    meta: { hideInMenu: false }
  },
  {
    name: '修改应用',
    path: '/add/app/:id',
    props: true,
    component: () => import('@/views/add/AddAppPage.vue'),
    meta: { hideInMenu: true }
  },

  // 应用详情
  {
    name: '应用详情',
    path: '/app/detail/:id',
    props: true,
    component: () => import('@/views/app/AppDetailPage.vue'),
    meta: { hideInMenu: true }
  },

  // 创建 题目 评分
  {
    name: '创建题目',
    path: '/add/question/:appId',
    props: true,
    component: () => import('@/views/add/AddQuestionPage.vue'),
    meta: { hideInMenu: true }
  },
  {
    name: '创建评分',
    path: '/add/scroing_result/:appId',
    props: true,
    component: () => import('@/views/add/AddScroingPage.vue'),
    meta: { hideInMenu: true }
  },
  
  // 答题 答题结果 我的答题
  {
    name: '答题',
    path: '/answer/do/:appId',
    props: true,
    component: () => import('@/views/answer/DoAnswerPage.vue'),
    meta: { hideInMenu: true, access: ACCESS_NUM.USER }
  },
  {
    name: '答题结果',
    path: '/answer/result/:id',
    props: true,
    component: () => import('@/views/answer/AnswerResultPage.vue'),
    meta: { hideInMenu: true, access: ACCESS_NUM.USER }
  },
  {
    name: '我的答题',
    path: '/answer/my',
    props: true,
    component: () => import('@/views/answer/MyAnswerPage.vue'),
    meta: { hideInMenu: false, access: ACCESS_NUM.USER }
  },
  // 表格管理
  {
    name: '用户管理',
    path: '/admin/user',
    component: () => import('@/views/admin/AdminUserPage.vue'),
    meta: { access: ACCESS_NUM.ADMIN }
  },
  {
    name: '应用管理',
    path: '/admin/app',
    component: () => import('@/views/admin/AdminAppPage.vue'),
    meta: { access: ACCESS_NUM.ADMIN }
  },
  {
    name: '题目管理',
    path: '/admin/question',
    component: () => import('@/views/admin/AdminQuestionPage.vue'),
    meta: { access: ACCESS_NUM.ADMIN }
  },
  {
    name: '评分管理',
    path: '/admin/scoring_result',
    component: () => import('@/views/admin/AdminScoringResultPage .vue'),
    meta: { access: ACCESS_NUM.ADMIN }
  },
  {
    name: '回答管理',
    path: '/admin/user_answer',
    component: () => import('@/views/admin/AdminUserAnswerPage.vue'),
    meta: { access: ACCESS_NUM.ADMIN }
  },
  {
    name: '应用统计',
    path: '/app_statics',
    component: () => import('@/views/satics/AppStaticPage.vue'),
    meta: { access: ACCESS_NUM.ADMIN }
  },

  // 登录/注册
  {
    name: '用户',
    path: '/user',
    component: () => import('@/layouts/UserLayout.vue'),
    meta: { hideInMenu: true },
    children: [
      {
        name: '用户登录',
        path: '/user/login',
        component: () => import('@/views/user/UserLoginPage.vue'),
        meta: { hideInMenu: false }
      },
      {
        name: '用户注册',
        path: '/user/register',
        component: () => import('@/views/user/UserRegisterPage.vue'),
        meta: { hideInMenu: false }
      },
    ]
  },
  {
    name: '无权限',
    path: '/noAuth',
    component: () => import('@/views/noAuth.vue'),
    meta: { hideInMenu: true }
  }
]

export default routes